class Person{
    String name;
    int age;
    String sex;
    public void sleep(){
        System.out.println(this.name+"正在睡觉");}
    public void show(){
        System.out.println("姓名："+this.name+" 年龄："+this.age+"性别："+this.sex);}

      public Person(){
          System.out.println("不带参数的构造方法");
      }

    public Person(String name, int age, String sex) {
        this.name = name;
        this.age = age;
        this.sex = sex;
        System.out.println("带有三个参数的构造方法");
    }
}

public class test {
    public static void main(String[] args) {   //另外两种方法
        Person person=new Person();
        person.name="陈冠宇";
        person.age=19;
        person.sex="女";
        person.show();
        person.sleep();
        System.out.println("======");
        Person person2=new Person("畅子丫",19,"女");
        person2.show();
    }


    public static void main1(String[] args) {   //较为常见的方法
        Person person1=new Person();
        Person person2=new Person();
        person1.name="陈冠宇";
        person1.age=19;
        person1.sex="男";
        person1.show();
        person1.sleep();
        System.out.println("======");
        person2.name="畅子丫";
        person2.age=19;
        person2.sex="女";
        person2.show();
        person2.sleep();
    }
}
